package com.edu.quartz.task;

import com.edu.framework.websocket.assemble.message.TriggerMsgEngine;
import com.edu.framework.websocket.service.CanteenService;
import com.edu.framework.websocket.service.CardService;
import com.edu.quartz.service.ISyncSchoolTimetableService;
import java.util.ArrayList;
import javax.annotation.Resource;
import org.springframework.stereotype.Component;

/**
 * 下发消息
 *
 * @author xxxx
 */
@Component("pushMsgBeatTask")
public class PushMsgBeatTask {

    @Resource
    private CanteenService wsCanteenService;
    @Resource
    private CardService wsCardService;

    /**
     * 下发
     */
    public void beatPush() {
        TriggerMsgEngine.runPushMsg();
    }

    /**
     * 每天初始化一次
     * 默认初始化当天的 需要触发下发消息的时间
     */
    public void initTriggerMsgDataPool(){
        TriggerMsgEngine.initMsgDataPool();
    }


    /**
     * 下发餐厅首页信息
     */
    public void pushCanteenCnt(){
        wsCanteenService.pushMsg(new ArrayList<>());
    }

    /**
     * 下发所有 有效的卡列表
     */
    public void pushCardInfoList(){
        wsCardService.pushCardList(new ArrayList<>());
    }

    /**
     * 主动申请拉 消费记录
     */
    public void pullChargeRecord(){
        wsCardService.pullChargeRecord();
    }

}
